# Installation directory for the files (set it on the 'make' command line)
HTMLDIR=
# These should all be generated files, since the 'clean' target nukes them
GENFILES=index.html help.html about.html

%.html: %.html.in footer.xml
	rm -f $@
	sed -e '/@FOOTER@/r footer.xml' $< >$@.tmp && mv $@.tmp $@
# Discourage users from editing this generated file
	chmod 444 $@

style.css: style.css.in style-colours.sed
	rm -f $@
	sed -f style-colours.sed style.css.in >$@.tmp && mv $@.tmp $@
# Discourage users from editing this generated file
	chmod 444 $@

install: style.css $(GENFILES)
	@test -n "$(HTMLDIR)" || { echo "No target directory specified: make HTMLDIR=xxx install" >&2 && false; }
	@test -d "$(HTMLDIR)" || { echo "Target directory $(HTMLDIR) does not exist" >&2 && false; }
	install -g www-data -m 664 $(GENFILES) style.css "$(HTMLDIR)"

clean:
	rm -f $(GENFILES) style.css
